package org.lv.learning.web;


import org.lv.learning.service.IStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 *
 */
@RestController
@RequestMapping("/storage")
public class StorageController {

    @Autowired
    private IStorageService storageService;

    /**
     *  扣减库存
     * @param productId
     * @param count
     * @return
     */
    @PutMapping("/deduct/{productId}/{count}")
    public Integer deduct(@PathVariable("productId") Long productId,
                          @PathVariable("count") Integer count) {
        return storageService.deduct(productId, count);
    }


}
